#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
#include<queue>

using namespace std;

int minOperations(vector<int>& nums, int k) {
    priority_queue<long long, vector<long long>, greater<long long>> pq;
    for (auto it : nums) pq.push(it);

    int res = 0;
    while (pq.top() < k)
    {
        auto t1 = pq.top();
        pq.pop();
        auto t2 = pq.top();
        pq.pop();
        pq.push(min(t1, t2) * 2 + max(t1, t2));
        res++;
    }
    return res;
}